let db = {
  getStorage: () => {
    return window.localStorage
  },
  get: (k, d = false) => {
    let ret = JSON.parse(window.localStorage.getItem(k))
    if (ret === null && d !== null) return d
    else return ret
  },
  set: (k, v) => {
    return window.localStorage.setItem(k, JSON.stringify(v))
  },
  del: (k) => {
    return window.localStorage.removeItem(k)
  },
  size: () => {
    return window.localStorage.length
  }
}

export default db
